// Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef CLOUDAPPENGINE_CAECONFIGMANAGE_H
#define CLOUDAPPENGINE_CAECONFIGMANAGE_H

#include <string>
#include <error.h>
#include "cJSON.h"

class CaeConfigManage {
public:
    static void SetConfig();

    static uint32_t GetListenIp();

    static uint16_t GetListenPortApp();

    static uint16_t GetListenPortH5();

    static uint32_t GetPauseTimes();

    static uint32_t GetHandShakeTimes();

    static uint32_t GetDisconnectTimes();

    static uint32_t GetNoTouchTimes();

    static uint32_t GetOutTimes();

    static uint32_t GetBaseTime();

    static const std::string &GetCaCertPath();

    static const std::string &GetCertPath();

    static const std::string &GetPrivKeyPath();

    static const std::string &GetCertUserData();

    static const std::string &GetSignCheckUrl();

    static const std::string &GetEventNotifyUrl();

    static const std::string &GetHeartbeatUrl();

    static const std::string &GetHeartbeatInterval();

    static bool EnableSignCheck();

    static bool EnableEventNotify();

    static bool EnableHeartbeatNotify();

    static bool EnableRemoteIme();

    static bool EnableDataChannel();

    static bool EnableVirtualDevice();

    static uint32_t GetHardwareHeight();

    static uint32_t GetHardwareWidth();

    static int GetLogLevel();

    static const std::string &GetPoolSchedulingElbIp();

    static uint16_t GetPoolSchedulingElbPort();

    static void InitMediaFeatures();

    static uint32_t GetFps();

    static bool IsSupportH264();

    static bool IsSupportH265();

    static bool IsSupportYuv();

    static bool IsSupportHardEncode();

    static bool IsSupportSoftEncode();

    static int GetOverrideFPS();

    static int GetOverrideBitrate();

    static bool IsOverrideBitrate();

    static bool IsOverrideFPS();

    static std::string GetRTSAAppId();

    static std::string GetRTSAAppKey();

    static std::string GetRTSAUserId();

    static std::string GetRTSARoomId();

    static uint32_t GetRTSAEnable();

    static uint32_t GetRTSANative();

    CaeConfigManage(const CaeConfigManage &) = delete;
    CaeConfigManage &operator = (const CaeConfigManage &) = delete;

    ~CaeConfigManage();

private:
    static void ReadConfig(const char *filename);

protected:
    CaeConfigManage();
};


#endif // CLOUDAPPENGINE_CAECONFIGMANAGE_H
